home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / vidmgr13.zip / VIOIMAGE.C < prev    next >
C/C++ Source or Header  |  1996-10-03  |  1KB  |  73 lines

  1. /*
  2.  *  VIOIMAGE.C; VidMgr routines for saving and restoring text images.
  3.  *              Release 1.2.
  4.  *
  5.  *  This module written in May 1996 by Andrew Clarke and released to the
  6.  *  public domain.
  7.  */
  8.  
  9. #include <stdlib.h>
  10. #include "vidmgr.h"
  11. #include "vioimage.h"
  12.  
  13. void vioImageDefaults(VIOIMAGE * v)
  14. {
  15.     v->width = 0;
  16.     v->height = 0;
  17.     v->image = NULL;
  18. }
  19.  
  20. int vioImageInit(VIOIMAGE * v, char width, char height)
  21. {
  22.     v->image = malloc(width * height * 2);
  23.     if (v->image)
  24.     {
  25.         v->width = width;
  26.         v->height = height;
  27.         return 1;
  28.     }
  29.     else
  30.     {
  31.         return 0;
  32.     }
  33. }
  34.  
  35. int vioImageTerm(VIOIMAGE * v)
  36. {
  37.     if (v->image)
  38.     {
  39.         free(v->image);
  40.         return 1;
  41.     }
  42.     else
  43.     {
  44.         return 0;
  45.     }
  46. }
  47.  
  48. int vioImageSave(VIOIMAGE * v, char x, char y)
  49. {
  50.     if (v->image)
  51.     {
  52.         vm_gettext(x, y, v->width, v->height, v->image);
  53.         return 1;
  54.     }
  55.     else
  56.     {
  57.         return 0;
  58.     }
  59. }
  60.  
  61. int vioImageRestore(VIOIMAGE * v, char x, char y)
  62. {
  63.     if (v->image)
  64.     {
  65.         vm_puttext(x, y, v->width, v->height, v->image);
  66.         return 1;
  67.     }
  68.     else
  69.     {
  70.         return 0;
  71.     }
  72. }
  73.